package lab02.test03;

public class Student {
    String name;
    long studentNum;

    float computer;
    float math;
    float English;

    public Student() {
    }

    public Student(float computer, float math, float English) {
        this.computer = computer;
        this.math = math;
        this.English = English;
    }

    public void setComputer(float computer) {
        this.computer = computer;
    }

    public float getComputer() {
        return computer;
    }

    public void setMath(float math) {
        this.math = math;
    }

    public float getMath() {
        return math;
    }

    public void setEnglish(float English) {
        English = English;
    }

    public float getEnglish() {
        return English;
    }//方法

    public float allScore() {
        return computer + math + English;
    }//总分

    public float averageScore() {
        return (computer + math + English) / 3;
    }//平均分

    public float maxScore() {
        float max = 0;
        max = (computer > math ? computer : math);
        max = (English > max ? English : max);
        return max;
    }//求最大值

    public float minScore() {
        float min = 0;
        min = (computer < math ? computer : math);
        min = (English < min ? English : min);
        return min;
    }//求最小值

    @Override
    public String toString() {
        return name + "\t" + studentNum;
    }//返回姓名、学号

    public void print() {
        System.out.println("计算机成绩为：" + computer);
        System.out.println("数学成绩为：" + math);
        System.out.println("英语成绩为：" + English);

        System.out.println("学生的总成绩为：" + allScore());
        System.out.println("学生的平均成绩为：" + averageScore());
        System.out.println("学生的最高分为：" + maxScore());
        System.out.println("学生的最低分为：" + minScore());
    }

}
